
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>50bus-register</title>
    <meta name="keywords" content="50bus" />
    <meta name="copyright" content="50bus.cn" />
    <!-- <meta http-equiv="mobile-agent" content="http://www.50bus.cn/" />
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" /> -->
    <link rel="icon" href="/resources/img/favicon.ico" type="image/x-icon" />
    
    <link rel="stylesheet" type="text/css" href="/resources/css/base.css" media="all" />
    <link rel="stylesheet" type="text/css" href="/resources/css/module-creative-dadong.css" media="all" />
    <link rel="stylesheet" type="text/css" href="/resources/css/globe.css" media="all" />
    <link rel="stylesheet" type="text/css" href="/resources/css/login.css" media="all" />
    <script type="text/javascript" src="/resources/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="/resources/js/jquery.validate.js"></script>
    <script type="text/javascript" src="/resources/js/jquery.form.js"></script>
    
</head>

<body>
    <div class="header_wrap">
        <div class="header clearfix">
            <div class="fm980 fl clearfix">
                <a href="/index.html" class="logo fl"></a>
                <ul class="nav_box fl">
                    <li><a href="/creative_list.html">形象创意</a></li>
                    <li><a href="/script_list.html">剧本创作</a></li>
                    <li><a href="/render_index.html">动画渲染</a></li>
                    <li><a href="/creative_helper.html">创意助手</a></li>
                </ul>
                <div class="about_box fr">
                    <a href="/about.html">关于我们</a>
                    <a href="/register.html" class="cur">注册</a>
                    <a href="/login.html" >登录</a>
                </div>
            </div>
        </div>

    </div>

    <div class="body_wrap">
        <div class="box_1">
            <h3 class="box_hd mb25">用户注册</h3>
            <div class="box_bd">
                <form id="per_register" action="per_register.json" method="post" >
                    <div class="item item_user clearfix">
                        <label>用户角色：</label>
                        <p><input type="radio" name="type" class="btn_rad1" checked /> 个人<input type="radio" class="btn_rad2 ml10" name="type"/> 企业</p>
                    </div>
                    <div class="tab tabbox1">	
	                    <div class="item clearfix">
	                        <label>邮箱地址：</label>
	                        <p><input id="email1" class="i_text" type="text" name="email1"/></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>密码：</label>
	                        <p><input id="pwd1" class="i_text" type="password" name="pwd1" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>重复密码：</label>
	                        <p><input id="pwds1" class="i_text" type="password" name="pwds1" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>昵称：</label>
	                        <p><input id="comp1" class="i_text" type="text" name="comp1" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>手机号：</label>
	                        <p><input id="tele1" class="i_text" type="text" name="tele1" /></p>
	                        <p class="item_link mt10" style="display:none;"><input type="checkbox" id="read1"  name="read1"/>同意
	                        <a href="javascript:void();" class="u_line blue_txt">服务条款</a> 和 <a href="javascript:void();" class="u_line blue_txt">隐私条款</a></p>
	                    </div>
	                    <div class="item sub_item ">
	                        <input id="submit1" style="cursor:pointer;" type="button" class="" value="加入我们"/>
	                    </div>
	            	</div><!-- tab end -->
	            </form>
	            <form id="comp_register" action="comp_register.json" method="post" style="padding-top:0;" >
	            	<div class="tab tabbox2" style="display:none;">	
	                    <div class="item clearfix">
	                        <label>邮箱地址：</label>
	                        <p><input id="email2" class="i_text" type="text" name="email2" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>密码：</label>
	                        <p><input id="pwd2" class="i_text" type="password" name="pwd2" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>重复密码：</label>
	                        <p><input id="pwds2" class="i_text" type="password" name="pwds2" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>公司名称：</label>
	                        <p><input id="comp2" class="i_text" type="text" name="comp2" /></p>
	                    </div>
	                    <div class="item clearfix">
	                        <label>手机号：</label>
	                        <p><input  id="tele2" class="i_text" type="text" name="tele2" /></p>
	                        <p class="item_link mt10" style="display:none;"><input type="checkbox" name="read2" id="read2"/> 同意 <a href="javascript:void();" class="u_line blue_txt">服务条款</a> 和 <a href="javascript:void();" class="u_line blue_txt">隐私条款</a></p>
	                    </div>
	                    <div class="item sub_item ">
	                        <input id="submit2" style="cursor:pointer;" type="button" class="" value="加入我们" />
	                    </div>
	            	</div><!-- tab end -->
                </form>
                <div class="box_ft">
                                                   已申请50bus帐号,请直接 <a href="/login.html" class="u_line blue_txt">登录</a>
                </div>
            </div>

        </div>

    </div>

    <div class="footer">
        <div class="fm980 clearfix">
            <img class="fl" src="/resources/img/foot_text.png" />
            <div class="copy_box fr">
                <p>版权所有 2014 50bus Corporation. 保留一切权利</p>
                <p><a href="">服务条款</a><a href="">隐私条款</a><a href="">法律条款</a></p>
            </div>
        </div>
    </div>
     
/*<style type="text/css"> 
* 
{ 
font-size: 14px; 
} 
#signupForm label.error 
{ 
color:Red; 
font-size:13px; 
margin-left:5px; 
padding-left:16px; 
background:url("error.png") left no-repeat; 
} 
</style>*/ 
<script type="text/javascript">
$('.btn_rad1').click(function(){
	$('.tab').hide();
	$('.tabbox1').show();
});
$('.btn_rad2').click(function(){
	$('.tab').hide();
	$('.tabbox2').show();	
});

$().ready(function() { 
$("#per_register").validate({ 
	rules: {
		email1: { 
		required: true, 
		email: true 
		}, 
		pwd1: { 
		required: true,                           
		rangelength: [7,11] 
		}, 
		pwds1: { 
		required: true, 
		rangelength: [7,11],
		equalTo: "#pwd1" 
		},
		read1:{
		required:false
		},
		comp1: "required", 
		tele1: {
		required: true, 
		minlength: 11,
		maxlength: 11,
		digits:true   
		}
	}, 
	messages: { 
		email1: { 
		required: "请输入Email地址", 
		email: "请输入正确的email" 
		}, 
		pwd1: { 
		required: "请输入密码", 
		rangelength: "请输入7到11个字符"
		}, 
		pwds1: { 
		required: "请输入确认密码", 
		rangelength: "请输入7到11个字符", 
		equalTo: "两次输入密码不一致" 
	    },
	    read1:{
		required:"请先阅读注册条约"
		},
	    comp1: "请输入用户昵称",      
	    tele1: {
	    required: "请输入手机号",
	    minlength: "请输入正确的手机号码",
		maxlength: "请输入正确的手机号码",
		digits:"请输入正确的手机号码" 
		}
	},
	//设置错误信息存放标签
	errorElement: "em",
	errorClass:"error",
	//指定错误信息位置
	errorPlacement: function (error, element) { 
  		if (element.is(':radio') || element.is(':checkbox')) {
      		error.appendTo(element.parent());
  		} 
  		else
  		{
      		error.appendTo(element.closest("p"));
 		}
	},
	
	//设置验证触发事件
	focusInvalid: true,
	//设置验证成功提示格式                                            
	success:function(e)
	{
		e.html("&nbsp;").addClass("valid").text('ok');
	},
    submitHandler:function(form){
    	formSubmit1($("#per_register"));
    } 
  });
  
  $("#comp_register").validate({ 
	rules: {
		email2: { 
		required: true, 
		email: true 
		}, 
		pwd2: { 
		required: true,                           
		rangelength: [7,11] 
		}, 
		pwds2: { 
		required: true, 
		rangelength: [7,11],
		equalTo: "#pwd2" 
		},
		read2:{
		required:false
		},
		comp2: "required", 
		tele2: {
		required: true, 
		minlength: 11,
		maxlength: 11,
		digits:true   
		}
	}, 
	messages: { 
		email2: { 
		required: "请输入Email地址", 
		email: "请输入正确的email" 
		}, 
		pwd2: { 
		required: "请输入密码", 
		rangelength: "请输入7到11个字符"
		}, 
		pwds2: { 
		required: "请输入确认密码", 
		rangelength: "请输入7到11个字符", 
		equalTo: "两次输入密码不一致" 
	    },
	    read2:{
		required:"请先阅读注册条约"
		},
	    comp2: "请输入公司名称",      
	    tele2: {
	    required: "请输入手机号",
	    minlength: "请输入正确的手机号码",
		maxlength: "请输入正确的手机号码",
		digits:"请输入正确的手机号码" 
		}
	},
	//设置错误信息存放标签
	errorElement: "em",
	//指定错误信息位置
	errorPlacement: function (error, element) { 
  		if (element.is(':radio') || element.is(':checkbox')) {
      		var eid = element.attr('name');
      		error.appendTo(element.parent());
  		} else {
      		error.appendTo(element.closest("p"));
 		}
	},
	//设置验证触发事件
	focusInvalid: true,
	//设置验证成功提示格式                                            
	success:function(e)
	{
		e.html("&nbsp;").addClass("valid").text('ok');
	},
    submitHandler:function(form){  
    	formSubmit2($("#comp_register"));
    }
  });
}); 
$("#submit1").click(function(){
	$("#per_register").submit();
});	
$("#submit2").click(function(){
	$("#comp_register").submit();
});	
function formSubmit1(form){
    form.ajaxSubmit({
        dataType: "json",                
		success: function(json)     
        {
        	if(json.success=="true")         
        	{
        		alert("注册成功");
        		location.href="/user/index.html?uid="+json.uid;
        	}
        	else if(json.comp=="false")
        	{                                 
        		alert("昵称已存在");
        	}
        	else if(json.email=="false")
        	{
        		alert("该邮箱已被注册");
        	}
        }
    });
};

function formSubmit2(form){
    form.ajaxSubmit({
        dataType: "json",
        success: function(json)         
        {
        	if(json.success=="true")             
        	{
        		alert("注册成功");
        		location.href="/user/index.html?uid="+json.uid;
        	}
        	else if(json.comp=="false")  
        	{     
        		alert("公司已存在");
        	}
        	else if(json.email=="false")
        	{
        		alert("该邮箱已被注册");
        	}
        }
    });
};
</script>
</body>
</html>